package com.gzc.pm.logic
{
	import cn.skyclass.business.SessionManager;
	import cn.skyclass.net.BaseLoader;
	
	import com.gzc.pm.bean.AlarmRuleBean;
	import com.gzc.pm.dao.AlarmRuleDao;
	
	import mx.rpc.events.ResultEvent;
	
	public class AlarmRuleLoader extends BaseLoader
	{
		public function AlarmRuleLoader(userId:String)
		{
			_userId = userId;
		}
		
		private var _userId:String;
		public var alarmRule:AlarmRuleBean;
		
		override protected function doLoad():void{
			var dao:AlarmRuleDao = new AlarmRuleDao();
			dao.getByUserId(_userId, onLoaded);
		}
		
		private function onLoaded(e:ResultEvent):void{
			alarmRule = e.result as AlarmRuleBean;
			SessionManager.current.setAttribute('alarmRule', alarmRule);
			
			dispatchLoadedEvent();
		}
		
	}
}